package com.spark.lola.mapper.pur;

import com.spark.lola.entity.pur.OrderProcess;
import com.spark.lola.support.mybatis.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author dengyejun
 * @since 2020-04-24
 */
@Mapper
public interface OrderProcessMapper extends BaseMapper<OrderProcess> {
    @Update("update pur_order_process set flag=0 where order_id=#{orderId} and action=#{action}")
    void resetFlag(@Param("orderId")Long orderId,@Param("action")Integer action);

    @Select("select create_time from pur_order_process where order_id=#{orderId} and flag=1 and action=#{action} order by id desc limit 1")
    Date getTimeByAction(@Param("orderId")Long orderId,@Param("action")Integer action);
}
